<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 通过一个对象操作另一个对象的属性
        let obj = {name:'张三'};
        let obj2 = {name:'李四', age:16};
        // 给obj设置age属性
        Object.defineProperty(obj,"age",{
            get(){
                return obj2.age;
            },
            set(value){
                obj2.age = value;
            }
        });
        // console.log(obj);
    </script>
</body>
</html>